<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>任务详情 - 威客任务平台</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
    <nav class="navbar navbar-expand-lg navbar-dark bg-dark">
        <div class="container">
            <a class="navbar-brand" href="/">威客任务平台</a>
            <div class="navbar-nav ms-auto">
                <a class="nav-link" th:href="@{/dashboard}">仪表板</a>
                <a class="nav-link" th:href="@{/admin/tasks}">任务管理</a>
                <a class="nav-link" th:href="@{/logout}">退出</a>
            </div>
        </div>
    </nav>

    <div class="container mt-4">
        <h2>任务详情</h2>
        
        <div class="card">
            <div class="card-body">
                <h5 class="card-title" th:text="${task.title}">任务标题</h5>
                <p class="card-text" th:text="${task.description}">任务描述</p>
                
                <ul class="list-group list-group-flush">
                    <li class="list-group-item">
                        <strong>任务ID:</strong> 
                        <span th:text="${task.taskId}">任务ID</span>
                    </li>
                    <li class="list-group-item">
                        <strong>雇主:</strong> 
                        <span th:text="${employer != null ? employer.username : '未知'}">雇主</span>
                    </li>
                    <li class="list-group-item">
                        <strong>预算:</strong> 
                        <span th:text="${'¥' + #numbers.formatDecimal(task.budget, 1, 2)}">预算</span>
                    </li>
                    <li class="list-group-item">
                        <strong>状态:</strong>
                        <span th:if="${task.taskStatus == 'open'}" class="badge bg-primary">待承接</span>
                        <span th:if="${task.taskStatus == 'in_progress'}" class="badge bg-warning">进行中</span>
                        <span th:if="${task.taskStatus == 'completed'}" class="badge bg-success">已完成</span>
                        <span th:if="${task.taskStatus == 'closed'}" class="badge bg-secondary">已关闭</span>
                    </li>
                    <li class="list-group-item">
                        <strong>发布时间:</strong> 
                        <span th:text="${#temporals.format(task.publishDate, 'yyyy-MM-dd HH:mm')}">发布时间</span>
                    </li>
                    <li class="list-group-item">
                        <strong>创建时间:</strong> 
                        <span th:text="${#temporals.format(task.createTime, 'yyyy-MM-dd HH:mm')}">创建时间</span>
                    </li>
                    <li class="list-group-item">
                        <strong>更新时间:</strong> 
                        <span th:text="${#temporals.format(task.updateTime, 'yyyy-MM-dd HH:mm')}">更新时间</span>
                    </li>
                </ul>
                
                <div class="mt-3">
                    <a th:href="@{/admin/tasks}" class="btn btn-primary">返回任务列表</a>
                    <a th:href="@{/admin/tasks/edit/{id}(id=${task.taskId})}" class="btn btn-warning">编辑任务</a>
                    <a th:href="@{/admin/tasks/delete/{id}(id=${task.taskId})}" 
                       class="btn btn-danger"
                       onclick="return confirm('确定要删除这个任务吗？')">删除任务</a>
                </div>
            </div>
        </div>
    </div>

    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>